package com.zrong.gamesdk.test.integration.app;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: zyzcl54
 * Date: 12-7-12
 * Time: 下午15:10
 * To change this template use File | Settings | File Templates.
 */
public class UserFavoriteApp {
    public static void main(String args[]) {
//        int lastIndex=70 ,startIndex=50,cacheSize=80;
//        int lastIndex1=70 ,startIndex1=50,cacheSize1=80;
//        int lastIndex2=110 ,startIndex2=90,cacheSize2=80;
//        System.out.print(lastIndex>cacheSize?((lastIndex-startIndex)-(lastIndex-cacheSize))+startIndex:lastIndex);
//        try {
//            UserFavorite userFavorite=new UserFavorite();
//            userFavorite.setUserId(10001);
//            userFavorite.setFavoriteOrigin(OriginsType.GAME_HALL.getValue());
//            userFavorite.setTargetObject("700012217000");
//            userFavorite.setTargetType(TargetType.GAME.getValue());
//            ExecutorService pool = Executors.newFixedThreadPool(4);
//            Runnable runnable1 = new UserFavoriteThread(userFavorite, 100);
//            Runnable runnable2 = new UserFavoriteThread(userFavorite, 500);
//            Runnable runnable3 = new UserFavoriteThread(userFavorite, 5000);
//            Runnable runnable4 = new UserFavoriteThread(userFavorite, 4000);
//            new Thread(runnable1).start();
//            new Thread(runnable2).start();
//            new Thread(runnable3).start();
//            new Thread(runnable4).start();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        List<String> arrayList=new ArrayList<String>(1000000);
        List<String> linkedList=new LinkedList<String>();
        for (int i=0;i<1000000;i++){
            arrayList.add("qweqweqweqweqwe");
            linkedList.add("sdfsdfsdfsdfsd");
        }

        List<String> outList = new ArrayList<String>(10000);
        long ct=System.currentTimeMillis();
        outList=arrayList.subList(50000,60000);
        System.out.println(System.currentTimeMillis()-ct);
        ct=System.currentTimeMillis();
        outList=linkedList.subList(50000,60000);
        System.out.println(System.currentTimeMillis()-ct);
    }
}
